配置方式失效,待更新…

环境配置

Scoop 安装

步骤 1:在 PowerShell 中打开远程权限

1
2
# 保证允许本地脚本的执行,以下命令皆在PowerShell中完成
Set-ExecutionPolicy RemoteSigned -scope CurrentUser

步骤 2:下载安装 Scoop

1
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

步骤 3:自定义 Scoop 包安装目录 [可选]

1
2
$env:SCOOP='Your_Scoop_Path'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')

跳过该步骤, Scoop 默认把用户安装的 App 和 Scoop 本身置于C:\Users\%username%\scoop文件夹

步骤 4:安装字体 [可选, 建议跳过]

1
2
3
4
5
6
# 搜索 nerd fonts,这里选择是的FantasqueSansMono这个字体
scoop search FantasqueSansMono-NF
# 添加 nerd fonts 源
scoop bucket add 'nerd-fonts'
# 安装 nerd fonts
scoop install FantasqueSansMono-NF

步骤 5: 安装 oh-my-posh

1
2
3
# 安装 posh-git 和 oh-my-posh
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

步骤 6:配置PROFILE

1
2
3
4
5
6
7
8
9
10
11
12
13
# 1.设置 Powershell 的 profile
if (!(Test-Path -Path $PROFILE )) {New-Item -Type File -Path $PROFILE -Force }

# 2.打开 profile 文件
code $PROFILE

# 3.粘贴以下内容进 profile 文件
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme jandedobbeleer # jandedobbeleer 可以替换为你喜欢的主题

# 4.退出并写入。必须这样写入,否则会提示没有权限保存
echo $profile

步骤 6 作用:PowerShell 关闭重新打开会还原为默认的样式,通过PROFILE文件可以使 PowerShell 每次启动时自动读取PROFILE文件的配置应用主题

主题推荐

jandedobbeleer

  • jandedobbeleer - Light

    jandedobbeleer - Light 预览

  • jandedobbeleer - Dark

    jandedobbeleer - Dark 预览

  • jandedobbeleer - Acrylic

    jandedobbeleer - Acrylic 预览

注意:由于字体字符不全,部分代码需要重写,否则会显示异常(乱码)
主题文件路径:C:\Users\%username%\Documents\WindowsPowerShell\Modules\oh-my-posh\3.158.3\themes

附主题 jandedobbeleer 重写后代码,适用于纯色背景
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
{
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#c386f1",
"leading_diamond": "<transparent,#c386f1>🔰</>",
"trailing_diamond": "",
"properties": {
"postfix": " ",
"display_host": false
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#ff479c",
"properties": {
"prefix": " 📂",
"home_icon": "~",
"folder_separator_icon": " \uE0b1 ",
"style": "folder"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#fffb38",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc",
"stash_count_icon": "\uF692 "
}
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#6CA35E",
"properties": {
"prefix": " \uF898 ",
"display_version": true
}
},
{
"type": "go",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#8ED1F7",
"properties": {
"prefix": " \uE626 ",
"display_version": true
}
},
{
"type": "julia",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#4063D8",
"properties": {
"prefix": " \uE624 ",
"display_version": true
}
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#FFDE57",
"properties": {
"prefix": " 🐍 ",
"display_version": true,
"display_mode": "files",
"display_virtual_env": false
}
},
{
"type": "ruby",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#AE1401",
"properties": {
"prefix": " \uE791 ",
"display_version": true,
"display_mode": "files"
}
},
{
"type": "azfunc",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#FEAC19",
"properties": {
"prefix": " \uf0e7",
"display_version": false,
"display_mode": "files"
}
},
{
"type": "aws",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background_templates": [
"{{if contains \"default\" .Profile}}#FFA400{{end}}",
"{{if contains \"jan\" .Profile}}#f1184c{{end}}"
],
"properties": {
"prefix": " \uE7AD ",
"display_default": false
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#fff100",
"properties": {
"root_icon": "⚡"
}
},
{
"type": "executiontime",
"style": "plain",
"foreground": "#ffffff",
"background": "#83769c",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"always_enabled": true,
"prefix": "<transparent></> \u231B"
}
},
{
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00e500",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1080c",
"color_background": true,
"prefix": "<#83769c></> 🔥"
}
},
{
"type": "shell",
"style": "plain",
"foreground": "#ffffff",
"background": "#0077c2",
"properties": {
"prefix": "<transparent></> 💠",
"postfix": " <transparent,#0077c2>\uE0B2</>"
}
},
{
"type": "ytm",
"style": "powerline",
"powerline_symbol": "\uE0B2",
"invert_powerline": true,
"foreground": "#111111",
"background": "#1BD760",
"properties": {
"prefix": " \uF167 ",
"paused_icon": " ",
"playing_icon": " "
}
},
{
"type": "battery",
"style": "powerline",
"invert_powerline": true,
"powerline_symbol": "\uE0B2",
"foreground": "#ffffff",
"background": "#f36943",
"properties": {
"battery_icon": "",
"discharging_icon": " ",
"charging_icon": " ",
"charged_icon": " ",
"color_background": true,
"charged_color": "#4caf50",
"charging_color": "#40c4ff",
"discharging_color": "#ff5722",
"postfix": " "
}
},
{
"type": "time",
"style": "diamond",
"invert_powerline": true,
"leading_diamond": "\uE0B2",
"background": "#2e9599",
"foreground": "#111111",
"properties": {
"postfix": "<transparent,#2e9599>⌚</> "
}
}
]
},
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#63F08C",
"properties": {
"prefix": "",
"text": "💨"
}
}
]
}
],
"final_space": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{ .Shell }} in {{ .Folder }}"
}
附主题 jandedobbeleer 重写后代码,适用于Acrylic亚克力透明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
{
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#c386f1",
"leading_diamond": "<transparent,#c386f1>🔰</>",
"trailing_diamond": "",
"properties": {
"postfix": " ",
"display_host": false
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#ff479c",
"properties": {
"prefix": " 📂",
"home_icon": "~",
"style": "full"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#fffb38",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc",
"stash_count_icon": "\uF692 "
}
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#6CA35E",
"properties": {
"prefix": " \uF898 ",
"display_version": true
}
},
{
"type": "go",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#8ED1F7",
"properties": {
"prefix": " \uE626 ",
"display_version": true
}
},
{
"type": "julia",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#4063D8",
"properties": {
"prefix": " \uE624 ",
"display_version": true
}
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#FFDE57",
"properties": {
"prefix": " 🐍 ",
"display_version": true,
"display_mode": "files",
"display_virtual_env": false
}
},
{
"type": "ruby",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#AE1401",
"properties": {
"prefix": " \uE791 ",
"display_version": true,
"display_mode": "files"
}
},
{
"type": "azfunc",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#FEAC19",
"properties": {
"prefix": " \uf0e7",
"display_version": false,
"display_mode": "files"
}
},
{
"type": "aws",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background_templates": [
"{{if contains \"default\" .Profile}}#FFA400{{end}}",
"{{if contains \"jan\" .Profile}}#f1184c{{end}}"
],
"properties": {
"prefix": " \uE7AD ",
"display_default": false
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#fff100",
"properties": {
"root_icon": "⚡"
}
},
{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#83769c",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"always_enabled": true,
"prefix": "<transparent></> \u231B"
}
},
{
"type": "exit",
"style": "powerline",
"foreground": "#ffffff",
"background": "#00e500",
"powerline_symbol": "",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1080c",
"color_background": true,
"prefix": "<transparent></> 🩺"
}
},
{
"type": "shell",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#0077c2",
"properties": {
"prefix": "<transparent></> 💠",
"postfix": " <transparent></>"
}
},
{
"type": "ytm",
"style": "powerline",
"powerline_symbol": "\uE0B2",
"invert_powerline": true,
"foreground": "#111111",
"background": "#1BD760",
"properties": {
"prefix": " \uF167 ",
"paused_icon": " ",
"playing_icon": " "
}
},
{
"type": "battery",
"style": "powerline",
"invert_powerline": true,
"powerline_symbol": "\uE0B2",
"foreground": "#ffffff",
"background": "#f36943",
"properties": {
"battery_icon": "🔋",
"discharging_icon": "⛔",
"charging_icon": "⚡",
"charged_icon": "🔋",
"color_background": true,
"charged_color": "#4caf50",
"charging_color": "#40c4ff",
"discharging_color": "#ff5722",
"postfix": "% "
}
},
{
"type": "time",
"style": "diamond",
"invert_powerline": true,
"leading_diamond": "",
"background": "#2e9599",
"foreground": "#111111",
"properties": {
"postfix": "<transparent,#2e9599>⌚</> "
}
}
]
},
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#63F08C",
"properties": {
"prefix": "",
"text": "💨"
}
}
]
}
],
"final_space": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{ .Shell }} in {{ .Folder }}"
}

附:部分图标 Unicode 码

Markdown 格式:&#x+unicode+;

⏰23F0 💨1F4A8 📂1C4C2

附:Scoop 插件推荐

windows-screenfetch

1
2
3
4
5
# 安装
Install-Module -Name windows-screenfetch

# 调用
screenfetch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
                         ....::::       21979@DESKTOP-6JKQ100
....:::::::::::: OS: Microsoft Windows 10 专业版 64 位
....:::: :::::::::::::::: Kernel: 10.0.19042
....:::::::::::: :::::::::::::::: Uptime: 0d 17h 10m 26s
:::::::::::::::: :::::::::::::::: Motherboard: LENOVO Lenovo B51-80
:::::::::::::::: :::::::::::::::: Shell: PowerShell 5.1.19041.610
:::::::::::::::: :::::::::::::::: Resolution: 1366 x 768 1920 x 1080
:::::::::::::::: :::::::::::::::: Window Manager: DWM
................ ................ Font: Segoe UI
:::::::::::::::: :::::::::::::::: CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
:::::::::::::::: :::::::::::::::: GPU AMD Radeon (TM) R5 M330
:::::::::::::::: :::::::::::::::: RAM: 4917MB / 12146 MB (40%)
'''':::::::::::: :::::::::::::::: Disk C: 62GB / 111GB (56%)
'''':::: :::::::::::::::: Disk D: 22GB / 120GB (18%)
'''':::::::::::: Disk E: 25GB / 300GB (8%)
'''':::: Disk F: 6GB / 500GB (1%)